import request from "@/utils/request";

export const API = {
  // 获取企业信用报告列表
  getCorporateCredit: "/cmsMatchEnterprise",
  // 获取企业信用报告详情
  getCorporateCreditDetail: "/cmsMatchEnterprise/getEnterpriseReport",
  // 搜索企业信用报告
  searchCorporateCredit: "/corporateCredit/searchCorporateCredit",
  // 授权信息开始匹配
  startMatching: "/corporateCredit/startMatching",
  // 获取字典
  // searchDicList: "/dict/data/getDictTypes/",
  // 纳税信息
  getTaxDetail: "/cmsMatchEnterprise/getEnterprisePaidTaxesAmount/",
  // 获取开票金额
  getTaxAmount: "/cmsMatchEnterprise/getEnterpriseApplyAmount/",
  // 获取工商司法
  getEnterpriseCases: "/cmsMatchEnterprise/getEnterpriseCases/",
  // 企业匹配
  enterpriseMatching: "/cmsMatchEnterprise/createMatchEnterprise",
  // 用户匹配状态获取
  getMatchStatusCount: "/cmsMatchEnterprise/getMatchStatusCount",
  // 个体获取手机号验证码
  getSmsCode: "/sso/getSmsCode",
  // 新增个体匹配信息
  createCmsMatchIndividual: "/cmsMatchIndividual/createCmsMatchIndividual",
  // 查询产品成功匹配结果
  // getMatchProductSuccessResult: '/match/resultList',
  // 查询产品成功匹配失败原因
  getMatchProductFinalResult: "/match/getMatchProductFinalResult",
  // 根据个体匹配信息id获取详细信息
  getcmsMatchIndividual: "/cmsMatchIndividual/",
  // 查询个体工商司法信息
  getIndividualCases: "/cmsMatchIndividual/getIndividualCases/",
  // 个体查询准入地区
  getArealist: "/area/list/",
  // 精准匹配
  accurateMatching: "/match/getPrecisionMatchResult",
  // 文章列表
  articleListApi: "/article/page",
  // 文章详情
  articleDetailApi: "/article/info",
  shareUse: "/tax/share/getTaxQueryShare",
};

/**
 * 字典数据查询
 * @param params
 * @returns {Promise<*>}
 */
export function searchDicListApi(params) {
	return request.get(`/dict/data/getDictTypes/` + params);
}
export function shareLoginApi (params) {
    return request.post('/tax/share/login', params)
}
// 获取历史查询记录列表
export function getSearchList(params) {
  return request.get("/tax/search/listAll", {params});
}

// 获取企业信息 - 根据公司名称
export function getEnterpriseSearch(params) {
  return request.post("/tax/getEnterpriseSearch",  params );
}

// 删除历史查询记录列表

export function deleteSearchRecord(id){
  return request.delete(`/tax/search/${id}` );
}
//校验用户是否答题
export function checkAnswer() {
	return request.get('/match/checkMatchCount')
}

//创建匹配任务

export function createMatch(data) {
	return request.post('/cmsMatchEnterprise/create/questionMatch', data)
}
/**
 * 根据id 获取问题
 * @returns {*}
 */
export function QuestionId(questionId) {
  return request.get(`/question/${questionId}`);
}


// 获取第一条数据

export function geFirstQuestion() {
	return request.get('/question/getFirstQuestion')
}

//新增用户记录
export function saveQuestion(data) {
	return request.post('/question/createAnswerSheet', data)
}



/**
 * 发送验证码
 * @param params
 * @returns {*}
 */
export function sendSmsCodeApi(params) {
  return request.post("/tax/tax/sendCode", params);
}
export function onlyAccountApi(data) {
  let params = {
    queryChannel: "2",
    ...data,
    // appid: H5_APP_ID,
  };
  return request.post("/tax/tax/onlyAccountLogin", params);
}
/**
 * 验证码登录
 * @param params
 * @returns {*}
 */
export function taxCaptchaApi(params) {
  return request.post("/tax/tax/captchaLogin", params);
}
/**
 * 税务系统账号登录
 * @param params
 * @returns {*}
 */
export function taxCompanyLoginApi(data) {
  let params = {
    queryChannel: "2",
    // appId: H5_APP_ID,
    ...data,
  };
  return request.post("/tax/tax/login", params);
}

/**
 * 企业匹配
 * @param params
 * @returns {Promise<*>}
 */
export function createMatchEnterpriseApi(params) {
  return request.post("/cmsMatchEnterprise/createMatchEnterprise", params);
}

//获取匹配列表
export function getMatchEnterpriseListApi(params) {
  return request.get("/cmsMatchEnterprise", { params });
}


//获取产匹配的统计信息
export function getMatchStatisticsApi(params) {
  return request.get("/match/summary/", { params });
}
/**
 * 获取企业信用报告详情
 * @param params
 * @returns {*}
 */
export function getCorporateCreditDetailApi(params) {
  return request.get(`${API.getCorporateCreditDetail}/${params.id}`);
}
// 获取产品匹配列表
export function getMatchListApi(params) {
  return request.get("/match/summary/listProduct", { params });
}
// 获取统计产品数量
export function getProductCountApi(params) {
  return request.get("/match/summary/productNum", { params });
}
/**
 * 获取匹配信息
 * @param params
 * @returns {Promise<*>}
 */
export function getMatchInfoInfo(params) {
  return request.get("/cmsMatchEnterprise/getMatchInfo", { params });
}
/**
 * 获取纳税信息
 */
export function getTaxDetailApi(params) {
  return request.get(API.getTaxDetail + params);
}/**
 * 近三年纳税信息（匹配详情）
 * @param params
 * @returns {Promise<*>}
 */
export function getTaxInformationApi(params) {
  return request.get("/cmsMatchEnterprise/getEnterprisePaidTaxesDataList", {
    params,
  });
}
/**
 * 获取开票金额
 * @param params
 * @returns {Promise<*>}
 */
export function getTaxAmountApi(params) {
  return request.get(API.getTaxAmount + params);
}
export function getEnterpriseInvoiceTopTen(params) {
  return request.get(
    `/cmsMatchEnterprise/getEnterpriseInvoiceTopTen/${params}`
  );
}
/**
 * 根据个体匹配信息id获取详细信息
 * @param params
 * @returns {*}
 */
export function getcmsMatchIndividualApi(params) {
  return request.get(`${API.getcmsMatchIndividual}${params.id}`);
}
//获取补充信息
export function getSupplementApi(params) {
  return request.get(`/cmsMatchEnterprise/getMatchExtInfo`, { params });
}

//补充信息提交

export function addSupplementApi(params) {
  return request.put(`/cmsMatchEnterprise/retryMatch`, params);
}
/**
 * 获取征信状态
 * @returns {Promise<*>}
 */
export function getMatchCreditStatus(params) {
	return request.get('/cmsMatchEnterprise/getMatchCreditStatus', {params})
}
/**
 * 查询个体查询准入地区
 * @param params
 * @returns {*}
 */
export function getArealist(params) {
  return request.get(`${API.getArealist}${params.id}`);
}
/** 
 * 
 * 个体手机号获取验证码
 * @param params
 * @returns {Promise<*>}
 */
export function getSmsCodeApi(params) {
  return request.get(`${API.getSmsCode}`, { params });
}
/**
 * 新增个体匹配信息
 * @param params
 * @returns {Promise<*>}
 */
export function getCmsMatchApi(params) {
  return request.post(API.createCmsMatchIndividual, params);
}

//征信匹配
export function getCmsMatchZxApi(params) {
  return request.post('/match/uploadMatchCredit', params);
}

/**
 * 仍然申请 专家咨询
 * @param params
 * @returns {Promise<*>}
 */
export function customerConsultaApi(params) {
  return request.post("/match/customerConsulta", params);
}
/**
 * 获取产品详情
 * @param params
 * @returns {*}
 */
export function getProductDetailApi (params) {
    return request.get(`/product/info/${params.id}`)
}
 